<template>
  <div ref="container"></div>
</template>

<script lang="ts">
import { defineComponent, onMounted, PropType, ref } from "vue";
import { Chart } from "@antv/g2";
import { ChartCfg } from "@antv/g2/lib/interface";
export default defineComponent({
  props: {
    option: {
      type: Object as PropType<ChartCfg>,
    },
  },
  setup() {
    const container = ref<HTMLElement>();
    const chart = ref<Chart>();
    function start() {
      if (container.value) {
        chart.value = new Chart({
          container: container.value,
          width: 600,
          height: 300,
        });
      }
    }
    onMounted(() => {
      start();
    });
  },
});
</script>

<style scoped>
</style>

